package com.fiestas.activities;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;

import com.fiestas.R;
import com.fiestas.adapters.UserAdapter;
import com.fiestas.adapters.UserListAdapter;
import com.fiestas.dao.Socio;
import com.fiestas.db.DBManager;

public class ActivityUserProfile extends Activity{

	private TextView text;
	private DBManager dbManager;
	private ListView listView;
	private ArrayList<UserAdapter> user;
	private ArrayList<Socio> socios;
	private UserListAdapter adapter;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.user_profile_layout);
		text = (TextView) findViewById(R.id.textViewUserAdapterName);
		listView = (ListView) findViewById(R.id.userProfileList);
		dbManager = new DBManager(this);
		socios = new ArrayList<Socio>();
		text.setText("Bienvenido --> " + getIntent().getStringExtra("name"));
		user = new ArrayList<UserAdapter>();
		socios = dbManager.getAllMembers();
		for (int i = 0; i < socios.size(); i++) {
			user.add(new UserAdapter(socios.get(i), false));
			System.out.println(socios.get(i).getName());
		}
		adapter = new UserListAdapter(this, user);
		listView.setAdapter(adapter);
		System.out.println("USUARIOS --> " + listView.getCount());
	}
}
